package milkproduction.service;

import java.sql.SQLException;
import java.text.SimpleDateFormat;

import milkproduction.dao.ImpregnatorDAO;
import milkproduction.to.FinishedProductTO;

public class ImpregnatorService {
	private int productCnt;

	private static ImpregnatorService instance = new ImpregnatorService();

	private ImpregnatorDAO dao;

	private ImpregnatorService(){
		dao = ImpregnatorDAO.getInstance();
	}

	public static ImpregnatorService getInstance(){
		return instance;
	}
	//우유 9개에 1박스 포장
	public FinishedProductTO packaging(FinishedProductTO fpt) throws SQLException{
		int finishedProductNo = 0;
		int releaseNo= 0;
		int quantity = 0;
		int rowMilkNo = 0;
		String productDay = null;
		int containerNo = 0;
		if(productCnt==9){
			finishedProductNo = dao.selectFinishedProductNo();
			rowMilkNo = dao.selectRowMilkNo();
			containerNo = dao.selectContainerNo();
			quantity = productCnt;
			fpt = new FinishedProductTO(finishedProductNo, releaseNo, quantity, rowMilkNo, productDay, containerNo);
			dao.insertFinishedProduct(fpt);
		}
		return fpt;
	}
}
